home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-01.zip
/
01
/
Hity z okladki
/
OrgPlus 6 SBE
/
ORGPL.CAB
/
chartFunc.js
< prev
next >
Wrap
Text File
|
2006-09-20
|
14KB
|
565 lines
/**********************************************************
* *
* (C) Copyright 2002 - 2004, Human Concepts (tm) *
* *
***********************************************************
* File name: chartFunc.js *
* Author: Andrey Ponomarev *
**********************************************************/
window.onresize = onChartPageResized
window.onscroll = onChartPageScrolled
var strActiveBoxId = ""
var objBoxMouseOver
var timerId = -1
var nTimerCount = 0
function onBoxMouseMove()
{
nTimerCount = 0
var objGroup = GetGroupForObject(event.srcElement)
if ( typeof(objBoxMouseOver) == 'undefined' ||
objBoxMouseOver.id != objGroup.id ||
strActiveBoxId != objBoxMouseOver.id && timerId <= 0 )
{
objBoxMouseOver = objGroup
if (timerId > 0)
window.clearInterval(timerId)
timerId = window.setInterval("onTimerFunc()", 50)
}
}
function onBoxMouseOut()
{
if (timerId != -1)
{
var objGroup = GetGroupForObject(event.fromElement)
var objTo = GetGroupForObject(event.toElement)
if ( typeof(objTo) == 'undefined' || objTo == null || objGroup != objTo)
{
window.clearInterval(timerId)
timerId = -1
}
}
}
function onTimerFunc()
{
nTimerCount++
if (nTimerCount == 4)
{
window.clearInterval(timerId)
timerId = -1
onClickGroupObj(objBoxMouseOver)
}
}
function onClickGroup()
{
onClickGroupObj(event.srcElement)
}
function onClickGroupObj(obj)
{
if (typeof(obj) == "object")
{
var objGroup = GetGroupForObject(obj)
onSelectChartBox(objGroup)
}
}
function GetGroupForObject(obj)
{
var objGroup = obj
if ( obj != null && typeof(obj) != 'undefined' )
{
if (objGroup.nodeName == "textbox")
objGroup = objGroup.parentElement
if (objGroup.nodeName != "group")
{
var parent = objGroup.parentElement
if(parent.nodeName == "A") //drill
return parent.parentElement
return parent
}
}
return objGroup
}
function onClickPage()
{
clearBoxHighlighting()
strActiveBoxId = ""
var obj = top.hcNavigate
if ( typeof( obj ) == "object" && typeof( obj.clearPage ) != "undefined" )
obj.clearPage()
}
function onMouseWheeling()
{
//mouse wheel works only for IE 6
var obj = top.hcToolbar
if( typeof(obj) == "object" && typeof( obj.onChartMouseWheeling ) != "undefined" )
{
obj.onChartMouseWheeling(event)
}
}
function onChartPageInit()
{
if (getIEVersion() < 5.0)
{
document.body.innerText = "";
alert("You have an old version of Internet Explorer" + //Loc
" - Update it please at least to Version 5.0.\nTo have a full functionality " +
"you should install Version 5.5, 6.0 or higher.");
}
else
{
var oGroup
var strHash = window.location.hash
if ( strHash != "" )
{
var strId = strHash.substring( 1, strHash.length )
oGroup = getGroupBoxById(strId)
}
else
{
oGroup = findFirstGroupBox()
}
if ( typeof(oGroup) == "object" && oGroup != null)
{
if ( typeof(top.hcNavigate) == "object" && typeof (top.hcNavigate.fillPage) != "undefined" )
{
top.hcNavigate.fillPage(oGroup)
}
clearBoxHighlighting()
strActiveBoxId = oGroup.id
if ( strHash != "" )
{
highlightSelectedBox()
navigateDeffered()
}
}
else
{
strActiveBoxId = ""
}
initOverviewWindow()
updateOverviewWindow()
var obj = top.hcToolbar
if( typeof(obj) == "object" && typeof( obj.setZoom ) != "undefined" )
{
obj.ZoomToFitInit()
}
}
}
function onChartPageScrolled()
{
updateOverviewWindow()
}
function getProfilesObj()
{
return top.hcPersons.document.all["ProfileInfo"];
}
function updateOverviewWindow()
{
var obj = top.hcToolbar
if( typeof(obj) == "object" && typeof( obj.updateOverviewWindow ) != "undefined" )
{
obj.updateOverviewWindow()
}
}
function initOverviewWindow()
{
var obj = top.hcToolbar
if( typeof(obj) == "object" && typeof( obj.initOverviewWindow ) != "undefined" )
{
obj.initOverviewWindow()
}
}
function findFirstGroupBox()
{
var oGroup
var groupObjs = document.getElementsByTagName("group")
if (groupObjs.length > 0)
{
oGroup = groupObjs(1)
}
return oGroup
}
function onSelectChartBox(groupObj)
{
clearBoxHighlighting()
strActiveBoxId = groupObj.id
highlightSelectedBox()
var obj = top.hcNavigate
if( typeof( groupObj ) == "object" )
{
if ( typeof( obj ) == "object" && typeof( obj.fillPage ) != "undefined" )
{
obj.fillPage(groupObj)
}
}
}
function getGroupBoxById(strId)
{
var obj
if ( strId != "" )
{
var groupObjs = document.getElementsByTagName("group")
for (i = 0; i < groupObjs.length; i++)
{
if (groupObjs(i).id == strId)
{
return groupObjs(i)
}
}
}
return obj
}
function navigateBox(strId)
{
var obj = getGroupBoxById(strId)
if (typeof(obj) == "object")
{
onSelectChartBox(obj)
}
}
var timerNavigateId = -1
function navigateDeffered()
{
if(timerNavigateId == -1)
{
timerNavigateId = window.setInterval("onTimerNavigateFunc()", 150)
}
}
function onTimerNavigateFunc()
{
window.clearInterval(timerNavigateId)
timerNavigateId = -1
navigateBox(strActiveBoxId)
}
function onNavigatePageInit()
{
var obj = getGroupBoxById(strActiveBoxId)
if (typeof(obj) == "object")
{
onSelectChartBox(obj)
}
}
function highlightSelectedBox()
{
var obj = getGroupBoxById(strActiveBoxId)
setOpacityForGroupBox(obj, 0.4)
}
function clearBoxHighlighting()
{
if (strActiveBoxId != "")
{
var obj = getGroupBoxById(strActiveBoxId)
setOpacityForGroupBox(obj, 1.0)
}
}
function setOpacityForGroupBox(obj, val)
{
if (typeof(obj) == "object")
{
setOpacityForObjecs(obj, "rect", val)
setOpacityForObjecs(obj, "roundrect", val)
setOpacityForObjecs(obj, "shape", val)
setOpacityForObjecs(obj, "oval", val)
}
}
function setOpacityForObjecs(obj, name, val)
{
var rectObjs = obj.getElementsByTagName(name)
var fillObjs
var objFill
var strName
for (i = 0; i < rectObjs.length; i++)
{
fillObjs = rectObjs(i).getElementsByTagName("fill")
if (fillObjs.length > 0)
{
objFill = fillObjs(0)
strName = rectObjs(i).getAttribute("name")
if ( strName == "SelectTranspRect" ||
strName == "SelectRect" && getIEVersion() < 6.0 )
objFill.setAttribute("on", val != 1.0)
var objId = rectObjs(i).id
var bFound = false
if (objId != null)
{
var nLen = objId.length
var strToSearch = "_HitTestRect"
if (nLen > strToSearch.length )
{
var s = objId.substr(nLen - strToSearch.length, nLen - 1);
if (s == strToSearch)
bFound = true
}
}
if (!bFound)
objFill.setAttribute("opacity", val)
}
}
}
function onChartPageResized()
{
updateOverviewWindow()
}
function onWndResized()
{
var toolBar = top.hcToolbar
if (toolBar.bFitToWindow)
top.hcMain.scrolling='no';
if( typeof(toolBar) == "object" && typeof( toolBar.tryCenterPage ) != "undefined" &&
typeof( toolBar.ZoomToFit ) != "undefined" )
{
if (top.bAutoFitToWindow)
toolBar.ZoomToFit()
else
toolBar.tryCenterPage()
}
updateOverviewWindow()
}
function onPageInit() //SPb AGal 15.10.2004
{
var toolBar = top.hcToolbar
if (toolBar.visibility == "hidden")
{
toolBar.bFitToWindow = true;
toolBar.SetAutoFitFlag();
}
toolBar.bZoomInitReady = toolBar.bFitToWindow ? false : true;
onChartPageInit();
}
function getPersonsObj()
{
var spanObjs = top.hcPersons.document.body.children.tags("span")
if(spanObjs.length == 0)
return null
var idxObj = null
for(var j = 0; j < spanObjs.length; ++j)
{
if(spanObjs(j).id == "Index")
{
idxObj = spanObjs(j)
break
}
}
spanObjs = idxObj.children.tags("span")
if(spanObjs.length == 0)
return
var personsObj = null
for(var j = 0; j < spanObjs.length; ++j)
{
if(spanObjs(j).id == "Persons")
{
personsObj = spanObjs(j)
break
}
}
return personsObj
}
function getFieldsObj()
{
var spanObjs = top.hcPersons.document.body.children.tags("span")
if(spanObjs.length == 0)
return null
var idxObj = null
for(var j = 0; j < spanObjs.length; ++j)
{
if(spanObjs(j).id == "Index")
{
idxObj = spanObjs(j)
break
}
}
if(idxObj == null) return null
spanObjs = idxObj.children.tags("span")
if(spanObjs.length == 0)
return;
var fieldsObj = null
for(var j = 0; j < spanObjs.length; ++j)
{
if(spanObjs(j).id == "Fields")
{
fieldsObj = spanObjs(j)
break
}
}
return fieldsObj
}
function findPersonNode(id, parent)
{
if(parent == null)
{
parent = getPersonsObj()
if(parent == null) return null
}
var spanObjs = parent.children.tags("span")
if(spanObjs.length == 0)
return null
for(var j = 0; j < spanObjs.length; ++j)
{
if(spanObjs(j).id == id)
return spanObjs(j)
}
for(var j = 0; j < spanObjs.length; ++j)
{
var spanObj = findPersonNode(id,spanObjs(j))
if(spanObj != null) return spanObj
}
return null
}
var cellArray = null
function ShowHSProfile(profileId, bShow)
{
var strId = "prof"+profileId;
var objProf = document.all(strId)
if (objProf == null)
return;
var objGroup = GetGroupForObject(event.srcElement)
var objPerson = findPersonNode(objGroup.id, null)
if (objPerson == null)
return;
if (bShow)
{
var imgs = new Array()
var imgSrcs = new Array()
cellArray = new Array()
var paramObjs = objPerson.getElementsByTagName("param")
var rows = objProf.children[0].rows;
var k = 0, n = 0;
var cellright = null
for (i = 0; i < rows.length; ++i)
{
var cells = rows[i].cells;
var cell = cells[1];
var merged = false;
if (cell == null)
{
merged = true;
cell = cells[0];
}
else if (cellright == null)
cellright = cell
for (j = 0; j < paramObjs.length; ++j)
{
var p = paramObjs(j)
if (cell.id != null && cell.id == p.id)
{
if (p.img != null)
{
var img = cell.getElementsByTagName("img")[0]
if (img != null)
{
imgs[n] = img
if (merged)
img.merged = true
imgSrcs[n++] = p.name
}
}
else
{
if (p.name == "")
{
cell.innerHTML = " "
if (cell.style.textDecoration != "none")
{
cellArray[k++] = cell;
cellArray[k++] = cell.style.textDecoration;
cell.style.textDecoration = "none"
}
}
else
cell.innerText = p.name
}
break;
}
}
}
var w1 = objProf.children[0].clientWidth
var w2 = cellright != null ? cellright.clientWidth : null
for (i = 0; i < imgs.length; ++i)
{
var img = imgs[i]
img.src = imgSrcs[i]
if (img.merged != null)
img.width = w1 - 2;
else if (w2 != null)
img.width = w2 - 2;
}
}
var x = window.event.clientX + document.body.scrollLeft
var y = window.event.clientY + document.body.scrollTop
objProf.style.left = x
objProf.style.top = y
var strShowCmd = bShow ? "visible" : "hidden"
objProf.style.visibility = strShowCmd;
if (!bShow)
{
for (i = 0; i < cellArray.length; i +=2)
{
cellArray[i].style.textDecoration = cellArray[i+1]
}
}
}